#ifndef OPENCLDIALOG_H
#define OPENCLDIALOG_H

#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QRadioButton>
#include <QGroupBox>
#include <QButtonGroup>
#include <QCheckBox>
#include <QPushButton>

#include <CL/cl.hpp>

/// Dialog to enable/disable OpenCL and set the platform and device
class OpenCLDialog : public QDialog
{
    Q_OBJECT

    cl::Platform _selectedPlatform;
    cl::Device _selectedDevice;
    std::vector<cl::Platform> _platforms;
    std::vector<cl::Device> _devices;
    std::vector<QRadioButton*> _platformRB;
    std::vector<QRadioButton*> _deviceRB;
    QCheckBox* _enabled;
    QVBoxLayout* _mainLayout;
    QButtonGroup* _platformGroup;
    QButtonGroup* _deviceGroup;
    QGroupBox* _platformBox;
    QGroupBox* _deviceBox;
    QVBoxLayout* _platformBoxLayout;
    QVBoxLayout* _deviceBoxLayout;
    QPushButton* _okButton;
private slots:
    void platform_clicked();
    void device_clicked();
    void enabled_changed();
public:
    explicit OpenCLDialog(const std::vector<cl::Platform> platforms, QWidget *parent = 0);

    bool is_enabled() const;
    cl::Platform selected_platform() const;
    cl::Device selected_device() const;
signals:

public slots:

};

#endif // OPENCLDIALOG_H
